Getting only changed incidents

Hello Team,

I am trying to ingest the incident data into 3rd party system using REST API. If I get list of incidents till day1 and some of the incidents would not be in resolved state, on day2 I want to get incidents which are triggered on day2 and any changes for the day1 incidents like status changed from triggered to acknowledged or resolved or again moved to acknowledged from resolved state.

It would also be helpful if you share how to include incident timeline when I am getting list of incidents using REST API.

1 Like

Hi Vivek,

Have you taken a look at our API docs? We have information on incidents that might be useful.

List incidents: https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEzOA-list-incidents
Get an incident: https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE0MQ-get-an-incident
Update an incident: https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE0Mg-update-an-incident

Can you take a look at those pages and let us know if that helps? If you have a specific example, could you email support@pagerduty.com so that we can take a further look?

Thanks,
Abbott Brannon
Technical Support Specialist

Hello,

Same concerns as Vivek.

There is no way AFAIK to get all incidents created and updated since your last “dump”. The List Incidents endpoint doesn’t have any criteria to say “incidents updated since”.
IMHO you have to:

  • call List Incident with “since” parameter to gather at least new created incidents
  • call Get Incident for each unresolved incident you already collected
    You may also have a look to List Log Entries to get triggered/acknowledge/resolve events then define incidents to gather/update.

@vivek.1 Can you tell me what is your 3rd party system?
On my side it’s BigQuery and we want to collect PagerDuty data (including Incidents) to be able to make our own reporting in our dataviz tools. This also lets us cross PagerDuty data with other company data.

Better than improving PagerDuty API, we’ll really appreciate Pagerduty to provide an export feature for some 3rd party systems. What’s your opinion Vivek?

Regards,
Sébastien

Hi Sebastien,

The List Incidents API call allows the user to input a date_range and/or you can input a since or until timeframe. This does allow a user to input a specific date/time to search for.

As Sebastien mentioned, you can also use the List Log Entries for an incident API call.

Let us know if you are able to find a solution that works for your project(s).

Thanks,
Abbott
Technical Support Specialist

Hello @sébastien.de.nef,

Thanks for sharing your thoughts. I am also dumping it into bigquery for reporting and analysis purpose.
Doing complete dump is not a good idea so I am also thinking to do as you suggested, but it complicates the use cases.

If PagerDuty provided any API to query updates using a flag like “updated_since”, it is really helpful.

Regards,
Vivek

Hi Abbott,

The List Incidents API call allows the user to input a date_range and/or you can input a since or until timeframe. This does allow a user to input a specific date/time to search for.

It can’t be used in the use case Vivek and I explained. As I wrote with this endpoint using the “since” parameter (and setting it with the last time you query the endpoint) you’re able to list new created incidents but not updated ones.

eg: https://adeo.pagerduty.com/incidents/Q1MN6F2DUQ5Y4V/timeline
created at: 2022-01-26T10:44+01:00
acked at: 2022-01-26T10:55+01:00
resolved at: 2022-01-26T11:42+01:00

At 11:00, requesting since=09:45 + until=10:45 => I get the incident as Triggered.
At 12:00, requesting since=10:45 + until=11:45 => No results, even if the incident has been acked + resolved. So in the exported data the incident will stay Triggered forever.
I repeat: the endpoint doesn’t have any criteria to say “incidents updated since” (query based on last_status_changed_at and not created_at).

Regards,
Sébastien

Hi Sebastien,

Thanks for that clarification.

I’ve submitted this as a Feature Request for our product team.

Let me know if I can assist with anything else.

Cheers,

Hello Abbott,

Thanks for your support.

Do we have any API, where we can pass list of incidents and get those incidents.
Reason for this question: If we want to fetch list of unresolved incidents, which are dumped to our system, we need to call the below API per incident.

Get an incident: https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE0MQ-get-an-incident

It may result it to so many API calls.

Hi Vivek,

We have the List Incidents API call and Manage Incidents API call. To manage many incidents, I would recommend using the Manage Incidents call. You wouldn’t be fetching with this call however, you would be using the list of incidents and Acknowledging, resolving, escalating or reassigning.

It could be useful to use both of the above - Gather a list of your incidents with the first call and then use that information to manage the incidents with the second call.

Take a look at those and let me know if you have questions.

Thanks,
Abbott Brannon

Hello Abbott,
Thanks for your answer.
I am basically looking for an API to fetch the list of incidents based on incident id or incident number.

https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEzOA-list-incidents --> This fetches all incidents based on time window.

Is there any way we can pass incidents numbers like 1, 5, 10, 20, 30 and want to fetch only these incidents.

Hi Vivek,

We do not currently have an API call for this. Our current Get an Incident API call is for single incidents. I’ve submitted your interest in this as a Feature Request for our product team.

When we receive product feedback from a customer we create a new request for our Product team through a separate internal system. From there, the team is able to assess what is needed to complete the work.

Cheers,

1 Like

Hi, any news regarding this? It would be very helpful to limit the number of API calls we need to perform